You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ERP/TradeManage/CaiGou/CG_ChaseInHouseAddForTM2.aspx

375 lines
14 KiB
Plaintext

2 months ago
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CG_ChaseInHouseAddForTM2.aspx.cs" Inherits="TradeManage.CaiGou.CG_ChaseInHouseAddForTM2" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1">
<title>sku导入</title>
<link rel="stylesheet" type="text/css" href="../themes/New.css" />
<link href="../themes/default/easyui.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="../themes/icon.css" />
<link rel="stylesheet" type="text/css" href="../themes/uploadify.css" />
<script src="../Scripts/MicrosoftAjax.js" type="text/javascript"></script>
<script src="../Scripts/jquery.min.js" type="text/javascript"></script>
<script src="../Scripts/jquery.bgiframe.min.js" type="text/javascript"></script>
<script src="../Scripts/jquery.easyui.min.js" type="text/javascript"></script>
<script src="../Scripts/Global.js" type="text/javascript"></script>
<script type="text/javascript" src="../Scripts/uploadify/jquery.uploadify.js"></script>
<script src="../Scripts/ajaxfileupload.js" type="text/javascript"></script>
<script src="../Scripts/jquery.url.js" type="text/javascript"></script>
<script src="../Scripts/WindowLoad.js" type="text/javascript"></script>
<script src="../Scripts/Global.js" type="text/javascript"></script>
<script type="text/javascript">
var WindowLoadModel = new WindowLoad();
$(document).ready(function () {
WindowLoadModel.ApplicationPath = "../";
WindowLoadModel.ControlID = "WindowLoad";
WindowLoadModel.Isbgiframe = true;
WindowLoadModel.Load();
ajaxInit(WindowLoadModel);
$("#txt_Postion").focus();
ChaseId = $.url.param("ChaseId");
if (ChaseId == undefined) {
ChaseId = 0;
}
if (ChaseId > 0) {
GetChaseModel();
ReadGoods();
}
$(document).keyup(function (event) {
if (event.keyCode == 13) {
if ($("#txt_Postion").is(":focus") == true) {
$("#text_sku").focus();
}
// else
// if ($("#text_sku").is(":focus") == true) {
// CVSKU();
// }
}
});
});
var inlist = new Array();
var iserror = 0;
function CVSKU() {
inlist = new Array();
iserror = 0;
if (GoodsList != null) {
$(GoodsList).each(function () {
var md = new Object();
md.Id = 0;
md.GoodsNum = this.BuyNum - this.InGoodsNum;
md.State = 1;
md.GoodsCode = this.GoodsCode;
md.TypeCode = this.TypeCode;
md.StoreId = 0;
md.PostionId = 0;
md.PostionCode = $("#txt_Postion").val();
md.GoodsDetailId = this.DetailId;
md.AddNum = 0;
md.Price = this.GoodsPrice;
md.PostPrice = postprice;
Array.add(inlist, md);
});
}
var str = new String();
var arr = new Array();
str = jQuery.trim($("#text_sku").val());
arr = str.split('\n'); //注split可以用字符或字符串分割
var shmtl = "";
for (var i = 0; i < arr.length; i++) {
if (arr[i].length < 6) {
shmtl += "条码位数不对未识别\n";
iserror = 1;
}
else {
var num = arr[i].substr(arr[i].length - 3, 3);
var typecode = arr[i].substr(arr[i].length - 6, 3);
var goodscode = arr[i].substr(0, arr[i].length - 6);
var iscz = 0;
var isnum = 0;
$(inlist).each(function () {
if (this.GoodsCode == goodscode && this.TypeCode == typecode) {
iscz = 1;
this.AddNum += parseInt(num);
if (this.GoodsNum - this.AddNum >= parseInt(num))
isnum = 1;
}
});
if (iscz == 0) {
iserror = 1;
shmtl += goodscode + "-" + typecode + "【" + parseInt(num) + "】该编号没有在这个批次中找到\n";
}
else if (isnum == 0) {
iserror = 1;
shmtl += goodscode + "-" + typecode + "【" + parseInt(num) + "】该编号数量超过批次数量\n";
}
else
shmtl += goodscode + "-" + typecode + "【" + parseInt(num) + "】\n";
}
}
$("#text_sku2").val(shmtl);
}
var postprice = 0;
function GetChaseModel() {
var param = new Object();
param.ChaseId = ChaseId;
$.ajax({
url: "CaiGouService.asmx/GetPurchaseModel",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
async: false,
success: function (data) {
if (data.d != null) {
$("#txtChaseCode").html(data.d.ChaseCode);
$("#txtInName").html(data.d.InName);
$("#txtGoodsNum").html(data.d.GoodsNum);
if (data.d.PostFee != null && data.d.GoodsNum > 0)
postprice = data.d.PostFee / data.d.GoodsNum;
}
}
});
}
var GoodsList = null;
function ReadGoods() {
var param = new Object();
param.ChaseId = ChaseId;
$.ajax({
url: "CaiGouService.asmx/GetPurchaseInGoodsForTM",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
success: function (data) {
if (data.d != null) {
GoodsList = data.d;
BindBuyGoods();
}
}
});
}
function LinkGoods(GId) {
window.open("HuoWu/HW_GoodsAddForTM.aspx?Title=订单查询&GoodsId=" + GId);
}
function BindBuyGoods() {
if (GoodsList == null)
return;
var shtml = new Sys.StringBuilder();
shtml.append("<table class='DataGridTableStyle' style='width: 100%;'>");
var GId = 0;
$(GoodsList).each(function () {
var errorbtn = "";
// if (State < 3)
// errorbtn = "<a style='cursor: pointer; text-decoration: underline; color: blue;' id='a_adderror' DID='" + this.DetailId + "' GID='" + this.GoodsId + "' BNum='" + this.BuyNum + "' InNum='" + this.InGoodsNum + "'><img alt='' src='../images/add.ico' />保存</a> <a style='cursor: pointer; text-decoration: underline; color: blue;' id='a_delerror' DID='" + this.DetailId + "' GID='" + this.GoodsId + "'><img alt='' src='../images/del.gif' />删除</a>";
// var errorhtml = "<select class='selectClass' style='width:70px;' DID='" + this.DetailId + "' GID='" + this.GoodsId + "'><option value='污渍'>污渍</option><option value='破损'>破损</option><option value='质量问题'>质量问题</option></select>数量:<input class='editTextbox' style='width: 50px;' type='text' min='0' max='10000000' precision='0' colname='ErrorNum' DID='" + this.DetailId + "' GID='" + this.GoodsId + "' value='0'/>" + errorbtn + "<div errnum='" + this.ErrorNum + "' DID='" + this.DetailId + "' GID='" + this.GoodsId + "'>" + this.Error + "</div>";
if (this.GoodsId != GId) {
var img = "";
if (this.FirstImgUrl != null && this.FirstImgUrl != "")
img = "<img width='50' height='50' alt='' src='" + this.FirstImgUrl + "'>";
shtml.append("<tr><td colspan='9'>" + img + " 编号:<a style='cursor: pointer; text-decoration: underline; color: blue;' onclick='LinkGoods(" + this.GoodsId + ")'>" + this.GoodsCode + "</a> " + this.GoodsOldCode + " 货物名称:" + this.GoodsName + "</td></tr>");
shtml.append("<tr class='HeaderStyle'><th>编号</th><th>型号</th><th>描述</th><th>采购数量</th><th>已入库</th></tr>");
}
shtml.append("<tr class='DataGridRowStyle'><td><a>" + this.GoodsCode + "</a></td><td><a>" + this.TypeCode + "</a></td><td><span class='ms'> " + this.TypeDesc + " </span></td><td> <span>" + this.BuyNum + "</span></td><td><span>" + this.InGoodsNum + "</span></td></tr>");
GId = this.GoodsId;
}
);
shtml.append("</table>");
$("#dg_Goods").html(shtml.toString());
// $("input[colname='BuyNum']").MaskedTextBox();
// $("input[colname='BuyMoney']").MaskedTextBox();
// $("input[colname='CFNum']").MaskedTextBox();
// $("input[colname='InNum']").MaskedTextBox();
// if ($("#chk_dhsl").is(":checked") == true) {
// $("input[colname='InNum']").each(function () {
// $(this).val($(this).attr("max"));
// });
// }
$(".ms").each(function () {
var cc = jQuery.trim($(this).html());
if ($(this).html() != "") {
var cl = cc.substr(cc.length - 1, 1);
if (cl == "一" || cl == "二" || cl == "三") {
$(this).css("color", "red");
}
}
});
}
function Save() {
if ($("#txt_Postion").val() == "") {
alert("请输入库位编码");
return;
}
if ($("#text_sku").val() == "") {
alert("请输入sku编码");
return;
}
var KWCode = $("#txt_Postion").val();
var error = "";
var Postionlist = new Array();
var pmd = new Object();
pmd.PostionId = 0;
pmd.PostionCode = KWCode;
Array.add(Postionlist, pmd);
var param1 = new Object();
param1.list = Postionlist;
$.ajax({
url: "../CangKu/CangKuServer.asmx/IsPostionCodelList",
data: Sys.Serialization.JavaScriptSerializer.serialize(param1),
dataType: "json",
async: false,
success: function (data) {
if (data.d != "")
error = data.d;
}
});
if (error != "") {
alert(error);
return;
}
CVSKU();
if (iserror == 1) {
alert("请查看右边错误提示");
return;
}
saveDH();
}
function saveDH() {
var KWCode = $("#txt_Postion").val();
var param = new Object();
param.PostionCode = KWCode;
param.ChaseId = ChaseId;
param.IsGC = 0;
param.IsBH = 0;
param.IsZJ = 0;
param.IsDH = 0;
param.list = inlist;
WindowLoadModel.Show();
$.ajax({
url: "CaiGouService.asmx/SaveChaseInStoreForScan",
data: Sys.Serialization.JavaScriptSerializer.serialize(param),
dataType: "json",
success: function (data) {
WindowLoadModel.Hide();
alert("提交成功");
window.location.reload();
}
});
//if (window.parent != null)
// window.parent.CloseTab("采购单入库", Title);
}
</script>
</head>
<body class="headbody">
<div class="title_ico">
货物扫描入库</div>
<table border="1" cellpadding="0" cellspacing="0" style="width: 95%"
class="tableAll">
<tr>
<td class="f1" width="10%">批次信息</td>
<td>批次号:<a id="txtChaseCode"></a>采购人:<a id="txtInName"></a>采购总数量:<a id="txtGoodsNum"></a> </td>
</tr>
<tr>
<td class="f1">采购货物:</td>
<td >
<div id="dg_Goods"></div>
</td>
</tr>
<tr>
<td class="f1" width="10%">库位编码:</td>
<td>
<input id="txt_Postion" class="editTextbox" style="width:120px;" type="text" /><font color="red">注:这边先扫描库位条码,再扫描货物条码,扫描完,然后点击提交</font></td>
</tr>
<tr>
<td class="f1" width="10%">货物条码:</td>
<td>
<textarea id="text_sku" cols="50" rows="20" style="width: 49%; overflow: auto; height: 350px"></textarea><textarea id="text_sku2" cols="50" rows="20" style="width: 49%; overflow: auto; height: 350px"></textarea>
</td>
</tr>
<tr>
<td align="center" colspan="2">
<input id="btn_Save2" class="btnClass btnClassSave" type="button" value="提交入库" onclick="Save();"/></td>
</tr>
</table>
</body>
</html>