+
-
-
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_AssetsOutApply/FormView.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_AssetsOutApply/FormView.js
index 7820ea663..7265c870a 100644
--- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_AssetsOutApply/FormView.js
+++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_AssetsOutApply/FormView.js
@@ -34,12 +34,6 @@ var bootstrap = function ($, learun) {
$('#AOReasonType').lrDataItemSelect({ code: 'ReasonType' });
$('#AOCreateTime').val(learun.formatDate(new Date(), 'yyyy-MM-dd hh:mm:ss'));
$('#AOCreateUserId')[0].lrvalue = learun.clientdata.get(['userinfo']).userId;
- $('#AODepartment').lrselect({
- type: 'tree',
- allowSearch: true,
- url: top.$.rootUrl + '/LR_OrganizationModule/Department/GetTree',
- param: {}
- });
$('#AOCreateUserId').val(learun.clientdata.get(['userinfo']).realName);
$('#Ass_AssetsOutItemApply').jfGrid({
headData: [
@@ -78,84 +72,6 @@ var bootstrap = function ($, learun) {
});
}
},
- {
- label: "使用人", name: "AOIUserPeople", width: 100, align: "left",
- formatterAsync: function (callback, value, row, op, $cell) {
- learun.clientdata.getAsync('custmerData', {
- url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'BaseUser',
- key: value,
- keyId: 'f_userid',
- callback: function (_data) {
- callback(_data['f_realname']);
- }
- });
- }
- },
- {
- label: "原部门", name: "AOIOldDepartment", width: 100, align: "left",
- formatterAsync: function (callback, value, row, op, $cell) {
- learun.clientdata.getAsync('custmerData', {
- url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'classdata',
- key: value,
- keyId: 'id',
- callback: function (_data) {
- callback(_data['name']);
- }
- });
- }
- },
- {
- label: "原库房", name: "AOIStorageId", width: 100, align: "left",
- formatterAsync: function (callback, value, row, op, $cell) {
- learun.clientdata.getAsync('custmerData', {
- url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'Ass_StorageData',
- key: value,
- keyId: 'sid',
- callback: function (_data) {
- callback(_data['sname']);
- }
- });
- }
- },
- {
- label: "新使用人", name: "AOINewUsePeople", width: 100, align: "left",
- formatterAsync: function (callback, value, row, op, $cell) {
- learun.clientdata.getAsync('custmerData', {
- url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'BaseUser',
- key: value,
- keyId: 'f_userid',
- callback: function (_data) {
- callback(_data['f_realname']);
- }
- });
- }
- },
- {
- label: "新部门", name: "AOINewDepartment", width: 100, align: "left",
- formatterAsync: function (callback, value, row, op, $cell) {
- learun.clientdata.getAsync('custmerData', {
- url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'classdata',
- key: value,
- keyId: 'id',
- callback: function (_data) {
- callback(_data['name']);
- }
- });
- }
- },
- {
- label: "新库房", name: "AOINewStorageId", width: 100, align: "left",
- formatterAsync: function (callback, value, row, op, $cell) {
- learun.clientdata.getAsync('custmerData', {
- url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'Ass_StorageData',
- key: value,
- keyId: 'sid',
- callback: function (_data) {
- callback(_data['sname']);
- }
- });
- }
- },
{
label: '英文名称', name: 'AOIEName', width: 100, align: 'left'
},
@@ -164,13 +80,7 @@ var bootstrap = function ($, learun) {
},
{
label: '生产厂家', name: 'AOIManufacturer', width: 100, align: 'left'
- },
- {
- label: '资产规格', name: 'AOISpecification', width: 100, align: 'left'
- },
- {
- label: '用途', name: 'AOIUse', width: 100, align: 'left'
- },
+ }
],
height: 400,
mainId: 'AAIId',
@@ -219,7 +129,7 @@ var bootstrap = function ($, learun) {
return a.AOIOrder - b.AOIOrder;
}
// 设置表单数据
- setFormData = function (processId,param,callback) {
+ setFormData = function (processId, param, callback) {
if (!!processId) {
$.lrSetForm(top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsOutApply/GetFormDataByProcessId?processId=' + processId, function (data) {
for (var id in data) {
@@ -235,7 +145,7 @@ var bootstrap = function ($, learun) {
}
});
}
- callback&& callback()
+ callback && callback()
}
// 验证数据是否填写完整
validForm = function () {
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_AssetsOutApply/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_AssetsOutApply/Index.js
index 8aae66b68..ce22dd0e8 100644
--- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_AssetsOutApply/Index.js
+++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_AssetsOutApply/Index.js
@@ -110,7 +110,7 @@ var bootstrap = function ($, learun) {
if (learun.checkrow(keyValue)) {
learun.layerForm({
id: 'formAss_AssetsInfoApply',
- title: '查看调拨申请',
+ title: '查看出库申请',
url: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsOutApply/FormView?keyValue=' + keyValue,
width: 1000,
height: 600,
@@ -170,7 +170,7 @@ var bootstrap = function ($, learun) {
url: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsOutApplyIncomplete/Form?keyValue=' + keyValue,
width: 1000,
height: 700,
- btn: ["调拨", "关闭"],
+ btn: ["出库", "关闭"],
callBack: function (id) {
return top[id].acceptClick(refreshGirdData);
}
@@ -183,19 +183,19 @@ var bootstrap = function ($, learun) {
$('#gridtable').lrAuthorizeJfGrid({
url: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsOutApply/GetPageList',
headData: [
- { label: "调拨单流水号", name: "AOCode", width: 200, align: "left" },
- { label: "调拨总价", name: "AOPrice", width: 100, align: "left" },
- //{
- // label: "出库原因", name: "AOReasonType", width: 100, align: "left", formatterAsync: function (callback, value, row, op, $cell) {
- // learun.clientdata.getAsync('dataItem', {
- // key: value,
- // code: 'ReasonType',
- // callback: function (_data) {
- // callback(_data.text);
- // }
- // });
- // }
- //},
+ { label: "出库单流水号", name: "AOCode", width: 200, align: "left" },
+ { label: "出库总价", name: "AOPrice", width: 100, align: "left" },
+ {
+ label: "出库原因", name: "AOReasonType", width: 100, align: "left", formatterAsync: function (callback, value, row, op, $cell) {
+ learun.clientdata.getAsync('dataItem', {
+ key: value,
+ code: 'ReasonType',
+ callback: function (_data) {
+ callback(_data.text);
+ }
+ });
+ }
+ },
{ label: "项目名称", name: "AOProjectName", width: 150, align: "left" },
{ label: "申请时间", name: "AOCreateTime", width: 150, align: "left" },
{
@@ -222,14 +222,14 @@ var bootstrap = function ($, learun) {
}
},
{
- label: "调拨状态", name: "AOOutStatus", width: 100, align: "left",
+ label: "出库状态", name: "AOOutStatus", width: 100, align: "left",
formatter: function (cellvalue, row) {
if (cellvalue === 0) {
- return '
待调拨';
+ return '
待出库';
} else if (cellvalue === 2) {
- return '
调拨完成';
+ return '
出库完成';
} else {
- return '
部分调拨';
+ return '
部分出库';
}
}
}
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_AssetsOutItemApply/Form.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_AssetsOutItemApply/Form.cshtml
index 70e960c14..c9d20a97d 100644
--- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_AssetsOutItemApply/Form.cshtml
+++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_AssetsOutItemApply/Form.cshtml
@@ -37,10 +37,10 @@
单价
用途
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_AssetsOutItemApply/Form.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_AssetsOutItemApply/Form.js
index 4f8b2df85..d62f048d7 100644
--- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_AssetsOutItemApply/Form.js
+++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/AssetManagementSystem/Views/Ass_AssetsOutItemApply/Form.js
@@ -27,62 +27,38 @@ var bootstrap = function ($, learun) {
// 访问数据接口地址
url: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsType/GetAllTree'
});
- $('#AOIUsePeople').lrDataSourceSelect({ code: 'teacheruserdata', value: 'f_userid', text: 'f_realname' });
- $('#AOIOldDepartment').lrselect({
- type: 'tree',
- allowSearch: true,
- url: top.$.rootUrl + '/LR_OrganizationModule/Department/GetTree',
- param: {}
- });
- $('#AOIStorageId').lrDataSourceSelect({ code: 'Ass_StorageData', value: 'sid', text: 'sname' });
- $('#AOINewDepartment').lrselect({
- type: 'tree',
- allowSearch: true,
- url: top.$.rootUrl + '/LR_OrganizationModule/Department/GetTree',
- param: {},
- select: function (val) {
- var departmentId = "";
- if (val) {
- departmentId = val.value;
- }
- $('#AOINewUsePeople').lrselectRefresh({
- url: top.$.rootUrl + '/LR_OrganizationModule/User/GetListByDepartmentId?departmentId=' + departmentId,
- text: "F_RealName",
- value: "F_UserId"
- })
- }
- });
$('#AOINewUsePeople').lrselect({ value: 'F_UserId', text: 'F_RealName' });
$('#AOINewStorageId').lrDataSourceSelect({ code: 'Ass_StorageData', value: 'sid', text: 'sname' });
$("#AAOldCode").lrlayerselect({
treeUrl: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsType/GetAllTree',
- treeParentId: '',
- treeValueId: '',
- treeTextId: '',
- dataUrl: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfoItem/GetList',
- dataTreeId: 'AIASSClass',
- dataValueId: 'aiid',
- dataTextId: 'aiassname',
+ treeParentId: 'atptid',
+ treeValueId: 'atid',
+ treeTextId: 'aname',
+ dataUrl: top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfo/GetList',
+ dataTreeId: 'ATId',
+ dataValueId: 'AId',
+ dataTextId: 'AName',
grid: [
- { label: '资产编号', name: 'aicodenumjy', width: 150, align: 'left' },
- { label: '资产名称', name: 'aiassname', width: 150, align: 'left' },
+ { label: '资产编号', name: 'ACode', width: 200, align: 'left' },
+ { label: '资产名称', name: 'AName', width: 200, align: 'left' },
+ { label: "库存", name: "AStock", width: 80, align: "left" },
{
- label: '所在库房', name: 'aiistorageid', width: 100, align: 'left', formatterAsync: function (callback, value, row, op, $cell) {
- learun.clientdata.getAsync('custmerData', {
- url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'Ass_StorageData',
+ label: "单位", name: "AUnit", width: 80, align: "left", formatterAsync: function (callback, value, row, op, $cell) {
+ learun.clientdata.getAsync('dataItem', {
key: value,
- keyId: 'sid',
+ code: 'sldw',
callback: function (_data) {
- callback(_data['sname']);
+ callback(_data.text);
}
});
}
},
- { label: "资产型号", name: "amodel", width: 150, align: "left" },
- { label: "生产厂家", name: "amanufacturer", width: 150, align: "left" },
+ { label: "英文名称", name: "AEName", width: 200, align: "left" },
+ { label: "资产型号", name: "AModel", width: 200, align: "left" },
+ { label: "生产厂家", name: "AManufacturer", width: 200, align: "left" },
{
- label: "供应商", name: "asupplierid", width: 100, align: "left", formatterAsync: function (callback, value, row, op, $cell) {
+ label: "供应商", name: "ASupplierId", width: 100, align: "left", formatterAsync: function (callback, value, row, op, $cell) {
learun.clientdata.getAsync('custmerData', {
url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'Ass_SupplierData',
key: value,
@@ -97,26 +73,27 @@ var bootstrap = function ($, learun) {
select: function (values, texts) {
if (values && values.length > 0) {
//绑定
- $.lrSetForm(top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfoItem/GetFormData?keyValue=' + values[0], function (data) {
- data = data.Ass_AssetsInfoItem;
- $('#AOITId').lrselectSet(data.AIASSClass);
- $('#AOICode').val(data.AICodeNumJY);
- $('#AOIName').val(data.AIASSName);
- $('#AOIUnit').lrselectSet(data.AIUnits);
- $('#AOIModel').val(data.AISpecificationtype);
- $('#AOIManufacturer').val(data.AIManufacturer);
- $('#AOIPrice').val(data.AIAssValue);
- $('#AOISpecification').val(data.AISpecification);
- $('#AOIUse').val(data.AIUse);
- $('#AOIOldDepartment').lrselectSet(data.AIDepartment);
- $('#AOIUsePeople').lrselectSet(data.AIUsePeople);
- $('#AOIStorageId').lrselectSet(data.AIIStorageId);
+ $.lrSetForm(top.$.rootUrl + '/AssetManagementSystem/Ass_AssetsInfo/GetFormData?keyValue=' + values[0], function (data) {
+ data = data.Ass_AssetsInfo;
+ $('#AOITId').lrselectSet(data.ATId);
+ $('#AOICode').val(data.ACode);
+ $('#AOIName').val(data.AName);
+ $('#AOIUnit').lrselectSet(data.AUnit);
+ $('#AOIEName').val(data.AEName);
+ $('#AOIModel').val(data.AModel);
+ $('#AOIManufacturer').val(data.AManufacturer);
+ $('#AOIPrice').val(data.APrice);
+ maxstock = data.AStock;
+ if (data.HasDetail === true) {
+ $("#AOIStock").attr("checkexpession", "PositiveInteger");
+ } else {
+ $("#AOIStock").attr("checkexpession", "PositiveFloatint");
+ }
});
}
},
isMultiple: false
- });
- $('#AOIUnit').lrDataItemSelect({ code: 'sldw' });
+ }); $('#AOIUnit').lrDataItemSelect({ code: 'sldw' });
$('#AOIPhoto').lrUploader();
},
diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/Ass_AssetsInfoApply/Ass_AssetsInfoApplyService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/Ass_AssetsInfoApply/Ass_AssetsInfoApplyService.cs
index 92592e266..7eae4d3b3 100644
--- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/Ass_AssetsInfoApply/Ass_AssetsInfoApplyService.cs
+++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/Ass_AssetsInfoApply/Ass_AssetsInfoApplyService.cs
@@ -278,7 +278,7 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem
var assinfoapp = db.FindEntity
(m => m.AAProcessId == processId);
var assPurchase = db.FindEntity(a => a.PId == assinfoapp.PId);
//通知申请人
- var purchaseApplyEntity = db.FindEntity(a => a.PAId = assPurchase.PAId);
+ var purchaseApplyEntity = db.FindEntity(a => a.PAId == assPurchase.PAId);
purchaseApplyEntity.PIsInStorage = "已入库";
db.Update(purchaseApplyEntity);
if (null != assPurchase)
diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/Ass_AssetsOutApply/Ass_AssetsOutApplyService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/Ass_AssetsOutApply/Ass_AssetsOutApplyService.cs
index 17a2a60df..fc9b69213 100644
--- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/Ass_AssetsOutApply/Ass_AssetsOutApplyService.cs
+++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/AssetManagementSystem/Ass_AssetsOutApply/Ass_AssetsOutApplyService.cs
@@ -286,8 +286,6 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem
ac.ACInOrOut = false;
ac.ACReasonType = assinfoapp.AOReasonType;
ac.ACDetailId = assinfoapp.AOId;
- ac.ACDepartment = assinfoapp.AODepartment;
- ac.ACStorageId = assinfoapp.AOStorageId;
bool ifinsertac = false;
var Ass_AssetsOutItemApplyList =
@@ -302,220 +300,173 @@ namespace Learun.Application.TwoDevelopment.AssetManagementSystem
Ass_AssetsOutApplyIncomplete.AOCreateTime = DateTime.Now;
Ass_AssetsOutApplyIncomplete.AOOutStatus = 0;
- //存放位置变动
foreach (var outItemApply in Ass_AssetsOutItemApplyList)
{
- var Ass_AssetsInfoItemList = db.FindEntity(m => m.AICodeNumJY == outItemApply.AOICode);
- if (Ass_AssetsInfoItemList != null)
+ //先检查库存
+ var assinfoitem = assinfo.FirstOrDefault(m => m.ACode == outItemApply.AOICode);
+ if (assinfoitem.AStock >= outItemApply.AOIStock)
{
- //调拨
- if (assinfoapp.AOReasonType.ToInt() == 3)
+ ifinsertac = true;
+ //库存充足
+ if (assinfoitem.HasDetail == true)//有明细
{
-
- //消耗品
- if (Ass_AssetsInfoItemList.AIAssType == 1)
+ //库存明细
+ var Ass_AssetsInfoItemList =
+ db.FindList(m => m.AId == assinfoitem.AId && m.AIIsInStorage == true).Take(outItemApply.AOIStock.ToInt()).ToList();
+ for (int i = 0; i < Ass_AssetsInfoItemList.Count; i++)
{
- db.Delete(Ass_AssetsInfoItemList);
- //库存减1
- var assinfofather =
- db.FindEntity(a => a.AId == Ass_AssetsInfoItemList.AId);
- if (assinfofather.AStock > 1)
- {
- assinfofather.AStock = assinfofather.AStock - 1;
- }
-
- db.Update(assinfofather);
-
-
+ var Ass_AssetsChangeItem = new Ass_AssetsChangeItemEntity();
+ Ass_AssetsChangeItem.Create();
+ Ass_AssetsChangeItem.ACId = ac.ACId;
+ Ass_AssetsChangeItem.AIId = Ass_AssetsInfoItemList[i].AIId;
+ Ass_AssetsChangeItem.ACOldStock = assinfoitem.AStock;
+ Ass_AssetsChangeItem.AAmount = 1;
+ Ass_AssetsChangeItem.ACNewStock = Ass_AssetsChangeItem.ACOldStock - 1;
+ Ass_AssetsChangeItem.ACTime = DateTime.Now;
+ Ass_AssetsChangeItem.ACUserId = assinfoapp.AOCreateUserId;
+ Ass_AssetsChangeItem.ACInOrOut = false;
+ Ass_AssetsChangeItem.ACReasonType = assinfoapp.AOReasonType;
+ Ass_AssetsChangeItem.ACCStorageId = Ass_AssetsInfoItemList[i].AIIStorageId;
+ Ass_AssetsChangeItem.ACCStoragePosition = Ass_AssetsInfoItemList[i].AIIStoragePosition;
+ db.Insert(Ass_AssetsChangeItem);
+ //明细在库状态
+ Ass_AssetsInfoItemList[i].AIIsInStorage = false;
+ db.Update(Ass_AssetsInfoItemList[i]);
}
- Ass_AssetsInfoItemList.AIDepartment = outItemApply.AOINewDepartment;
- Ass_AssetsInfoItemList.AIIStorageId = outItemApply.AOINewStorageId;
- var storageInfo =
- db.FindEntity(a => a.SId == outItemApply.AOINewStorageId);
- Ass_AssetsInfoItemList.AIIStoragePosition = storageInfo?.SAdress;
- Ass_AssetsInfoItemList.AIUsePeople = outItemApply.AOINewUsePeople;
-
}
- //出库
+ else//无明细
+ {
+ var Ass_AssetsInfoItem =
+ db.FindEntity(m => m.AId == assinfoitem.AId);
+ var Ass_AssetsChangeItem = new Ass_AssetsChangeItemEntity();
+ Ass_AssetsChangeItem.Create();
+ Ass_AssetsChangeItem.ACId = ac.ACId;
+ Ass_AssetsChangeItem.AIId = Ass_AssetsInfoItem.AIId;
+ Ass_AssetsChangeItem.ACOldStock = assinfoitem.AStock;
+ Ass_AssetsChangeItem.AAmount = outItemApply.AOIStock;
+ Ass_AssetsChangeItem.ACNewStock = Ass_AssetsChangeItem.ACOldStock - outItemApply.AOIStock;
+ Ass_AssetsChangeItem.ACTime = DateTime.Now;
+ Ass_AssetsChangeItem.ACUserId = assinfoapp.AOCreateUserId;
+ Ass_AssetsChangeItem.ACInOrOut = false;
+ Ass_AssetsChangeItem.ACReasonType = assinfoapp.AOReasonType;
+ Ass_AssetsChangeItem.ACCStorageId = Ass_AssetsInfoItem.AIIStorageId;
+ Ass_AssetsChangeItem.ACCStoragePosition = Ass_AssetsInfoItem.AIIStoragePosition;
+ db.Insert(Ass_AssetsChangeItem);
+ //在库状态
+ if (Ass_AssetsChangeItem.ACNewStock == 0)
+ {
+ Ass_AssetsInfoItem.AIIsInStorage = false;
+ db.Update(Ass_AssetsInfoItem);
+ }
+ }
+ //库存扣减
+ assinfoitem.AStock = assinfoitem.AStock - outItemApply.AOIStock;
+ }
+ else
+ {
+ //库存不足
+ IsAllOutOrNot = false;
+ if (assinfoitem.HasDetail == true) //有明细
+ {
+ //库存明细
+ var Ass_AssetsInfoItemList =
+ db.FindList(m => m.AId == assinfoitem.AId && m.AIIsInStorage == true).ToList();
+ for (int i = 0; i < Ass_AssetsInfoItemList.Count; i++)
+ {
+ ifinsertac = true;
+ var Ass_AssetsChangeItem = new Ass_AssetsChangeItemEntity();
+ Ass_AssetsChangeItem.Create();
+ Ass_AssetsChangeItem.ACId = ac.ACId;
+ Ass_AssetsChangeItem.AIId = Ass_AssetsInfoItemList[i].AIId;
+ Ass_AssetsChangeItem.ACOldStock = assinfoitem.AStock;
+ Ass_AssetsChangeItem.AAmount = 1;
+ Ass_AssetsChangeItem.ACNewStock = Ass_AssetsChangeItem.ACOldStock - 1;
+ Ass_AssetsChangeItem.ACTime = DateTime.Now;
+ Ass_AssetsChangeItem.ACUserId = assinfoapp.AOCreateUserId;
+ Ass_AssetsChangeItem.ACInOrOut = false;
+ Ass_AssetsChangeItem.ACReasonType = assinfoapp.AOReasonType;
+ Ass_AssetsChangeItem.ACCStorageId = Ass_AssetsInfoItemList[i].AIIStorageId;
+ Ass_AssetsChangeItem.ACCStoragePosition = Ass_AssetsInfoItemList[i].AIIStoragePosition;
+ db.Insert(Ass_AssetsChangeItem);
+ //明细在库状态
+ Ass_AssetsInfoItemList[i].AIIsInStorage = false;
+ db.Update(Ass_AssetsInfoItemList[i]);
+ }
+ //缺货明细
+ var Ass_AssetsOutItemApplyIncomplete = new Ass_AssetsOutItemApplyIncompleteEntity();
+ Ass_AssetsOutItemApplyIncomplete.Create();
+ Ass_AssetsOutItemApplyIncomplete.AOAIId = Ass_AssetsOutApplyIncomplete.AOAIId;
+ Ass_AssetsOutItemApplyIncomplete.AOICode = outItemApply.AOICode;
+ Ass_AssetsOutItemApplyIncomplete.AOIName = outItemApply.AOIName;
+ Ass_AssetsOutItemApplyIncomplete.AOITId = outItemApply.AOITId;
+ Ass_AssetsOutItemApplyIncomplete.AOIEName = outItemApply.AOIEName;
+ Ass_AssetsOutItemApplyIncomplete.AOIPhoto = outItemApply.AOIPhoto;
+ Ass_AssetsOutItemApplyIncomplete.AOIContent = outItemApply.AOIContent;
+ Ass_AssetsOutItemApplyIncomplete.AOIOrder = outItemApply.AOIOrder;
+ Ass_AssetsOutItemApplyIncomplete.AOIModel = outItemApply.AOIModel;
+ Ass_AssetsOutItemApplyIncomplete.AOIManufacturer = outItemApply.AOIManufacturer;
+ Ass_AssetsOutItemApplyIncomplete.AOIHopeStock = outItemApply.AOIStock;
+ Ass_AssetsOutItemApplyIncomplete.AOIOutStock = Ass_AssetsInfoItemList.Count;
+ Ass_AssetsOutItemApplyIncomplete.AOIStock = outItemApply.AOIStock - Ass_AssetsInfoItemList.Count;
+ Ass_AssetsOutItemApplyIncomplete.AOIPrice = outItemApply.AOIPrice;
+ //总价计算
+ Ass_AssetsOutApplyIncomplete.AOPrice += Ass_AssetsOutItemApplyIncomplete.AOIPrice * Ass_AssetsOutItemApplyIncomplete.AOIStock;
+ Ass_AssetsOutItemApplyIncomplete.AOIUnit = outItemApply.AOIUnit;
+
+ db.Insert(Ass_AssetsOutItemApplyIncomplete);
+ }
else
{
- Ass_AssetsInfoItemList.AIIsInStorage = false;
+ if (assinfoitem.AStock > 0)
+ {
+ ifinsertac = true;
+ var Ass_AssetsInfoItem =
+ db.FindEntity(m => m.AId == assinfoitem.AId);
+ var Ass_AssetsChangeItem = new Ass_AssetsChangeItemEntity();
+ Ass_AssetsChangeItem.Create();
+ Ass_AssetsChangeItem.ACId = ac.ACId;
+ Ass_AssetsChangeItem.AIId = Ass_AssetsInfoItem.AIId;
+ Ass_AssetsChangeItem.ACOldStock = assinfoitem.AStock;
+ Ass_AssetsChangeItem.AAmount = assinfoitem.AStock;
+ Ass_AssetsChangeItem.ACNewStock = 0;
+ Ass_AssetsChangeItem.ACTime = DateTime.Now;
+ Ass_AssetsChangeItem.ACUserId = assinfoapp.AOCreateUserId;
+ Ass_AssetsChangeItem.ACInOrOut = false;
+ Ass_AssetsChangeItem.ACReasonType = assinfoapp.AOReasonType;
+ Ass_AssetsChangeItem.ACCStorageId = Ass_AssetsInfoItem.AIIStorageId;
+ Ass_AssetsChangeItem.ACCStoragePosition = Ass_AssetsInfoItem.AIIStoragePosition;
+ db.Insert(Ass_AssetsChangeItem);
+ //在库状态
+ Ass_AssetsInfoItem.AIIsInStorage = false;
+ db.Update(Ass_AssetsInfoItem);
+ }
+ //缺货明细
+ var Ass_AssetsOutItemApplyIncomplete = new Ass_AssetsOutItemApplyIncompleteEntity();
+ Ass_AssetsOutItemApplyIncomplete.Create();
+ Ass_AssetsOutItemApplyIncomplete.AOAIId = Ass_AssetsOutApplyIncomplete.AOAIId;
+ Ass_AssetsOutItemApplyIncomplete.AOICode = outItemApply.AOICode;
+ Ass_AssetsOutItemApplyIncomplete.AOIName = outItemApply.AOIName;
+ Ass_AssetsOutItemApplyIncomplete.AOITId = outItemApply.AOITId;
+ Ass_AssetsOutItemApplyIncomplete.AOIEName = outItemApply.AOIEName;
+ Ass_AssetsOutItemApplyIncomplete.AOIPhoto = outItemApply.AOIPhoto;
+ Ass_AssetsOutItemApplyIncomplete.AOIContent = outItemApply.AOIContent;
+ Ass_AssetsOutItemApplyIncomplete.AOIOrder = outItemApply.AOIOrder;
+ Ass_AssetsOutItemApplyIncomplete.AOIModel = outItemApply.AOIModel;
+ Ass_AssetsOutItemApplyIncomplete.AOIManufacturer = outItemApply.AOIManufacturer;
+ Ass_AssetsOutItemApplyIncomplete.AOIHopeStock = outItemApply.AOIStock;
+ Ass_AssetsOutItemApplyIncomplete.AOIOutStock = assinfoitem.AStock;
+ Ass_AssetsOutItemApplyIncomplete.AOIStock = outItemApply.AOIStock - assinfoitem.AStock;
+ Ass_AssetsOutItemApplyIncomplete.AOIPrice = outItemApply.AOIPrice;
+ //总价计算
+ Ass_AssetsOutApplyIncomplete.AOPrice += Ass_AssetsOutItemApplyIncomplete.AOIPrice * Ass_AssetsOutItemApplyIncomplete.AOIStock;
+ Ass_AssetsOutItemApplyIncomplete.AOIUnit = outItemApply.AOIUnit;
+ db.Insert(Ass_AssetsOutItemApplyIncomplete);
}
- db.Update(Ass_AssetsInfoItemList);
+ //库存扣减
+ assinfoitem.AStock = 0;
}
-
-
- ////先检查库存
- //var assinfoitem = assinfo.FirstOrDefault(m => m.ACode == outItemApply.AOICode);
- //if (assinfoitem.AStock >= outItemApply.AOIStock)
- //{
- // ifinsertac = true;
- // //库存充足
- // if (assinfoitem.HasDetail == true)//有明细
- // {
- // //库存明细
- // var Ass_AssetsInfoItemList =
- // db.FindList(m => m.AId == assinfoitem.AId && m.AIIsInStorage == true).Take(outItemApply.AOIStock.ToInt()).ToList();
- // for (int i = 0; i < Ass_AssetsInfoItemList.Count; i++)
- // {
- // var Ass_AssetsChangeItem = new Ass_AssetsChangeItemEntity();
- // Ass_AssetsChangeItem.Create();
- // Ass_AssetsChangeItem.ACId = ac.ACId;
- // Ass_AssetsChangeItem.AIId = Ass_AssetsInfoItemList[i].AIId;
- // Ass_AssetsChangeItem.ACOldStock = assinfoitem.AStock;
- // Ass_AssetsChangeItem.AAmount = 1;
- // Ass_AssetsChangeItem.ACNewStock = Ass_AssetsChangeItem.ACOldStock - 1;
- // Ass_AssetsChangeItem.ACTime = DateTime.Now;
- // Ass_AssetsChangeItem.ACUserId = assinfoapp.AOCreateUserId;
- // Ass_AssetsChangeItem.ACInOrOut = false;
- // Ass_AssetsChangeItem.ACReasonType = assinfoapp.AOReasonType;
- // Ass_AssetsChangeItem.ACCStorageId = Ass_AssetsInfoItemList[i].AIIStorageId;
- // Ass_AssetsChangeItem.ACCStoragePosition = Ass_AssetsInfoItemList[i].AIIStoragePosition;
- // db.Insert(Ass_AssetsChangeItem);
- // //明细在库状态
- // Ass_AssetsInfoItemList[i].AIIsInStorage = false;
- // Ass_AssetsInfoItemList[i].AIDepartment = assinfoapp.AODepartment;
- // Ass_AssetsInfoItemList[i].AIIStorageId = assinfoapp.AOStorageId;
- // Ass_AssetsInfoItemList[i].AIIStoragePosition = this.BaseRepository().FindEntity(a => a.SId == assinfoapp.AOStorageId)?.SAdress;
-
-
- // db.Update(Ass_AssetsInfoItemList[i]);
- // }
-
- // }
- // else//无明细
- // {
- // var Ass_AssetsInfoItem =
- // db.FindEntity(m => m.AId == assinfoitem.AId);
- // var Ass_AssetsChangeItem = new Ass_AssetsChangeItemEntity();
- // Ass_AssetsChangeItem.Create();
- // Ass_AssetsChangeItem.ACId = ac.ACId;
- // Ass_AssetsChangeItem.AIId = Ass_AssetsInfoItem.AIId;
- // Ass_AssetsChangeItem.ACOldStock = assinfoitem.AStock;
- // Ass_AssetsChangeItem.AAmount = outItemApply.AOIStock;
- // Ass_AssetsChangeItem.ACNewStock = Ass_AssetsChangeItem.ACOldStock - outItemApply.AOIStock;
- // Ass_AssetsChangeItem.ACTime = DateTime.Now;
- // Ass_AssetsChangeItem.ACUserId = assinfoapp.AOCreateUserId;
- // Ass_AssetsChangeItem.ACInOrOut = false;
- // Ass_AssetsChangeItem.ACReasonType = assinfoapp.AOReasonType;
- // Ass_AssetsChangeItem.ACCStorageId = Ass_AssetsInfoItem.AIIStorageId;
- // Ass_AssetsChangeItem.ACCStoragePosition = Ass_AssetsInfoItem.AIIStoragePosition;
- // db.Insert(Ass_AssetsChangeItem);
- // //在库状态
- // if (Ass_AssetsChangeItem.ACNewStock == 0)
- // {
- // Ass_AssetsInfoItem.AIIsInStorage = false;
- // db.Update(Ass_AssetsInfoItem);
- // }
- // }
- // //库存扣减
- // assinfoitem.AStock = assinfoitem.AStock - outItemApply.AOIStock;
- //}
- //else
- //{
- // //库存不足
- // IsAllOutOrNot = false;
- // if (assinfoitem.HasDetail == true) //有明细
- // {
- // //库存明细
- // var Ass_AssetsInfoItemList =
- // db.FindList(m => m.AId == assinfoitem.AId && m.AIIsInStorage == true).ToList();
- // for (int i = 0; i < Ass_AssetsInfoItemList.Count; i++)
- // {
- // ifinsertac = true;
- // var Ass_AssetsChangeItem = new Ass_AssetsChangeItemEntity();
- // Ass_AssetsChangeItem.Create();
- // Ass_AssetsChangeItem.ACId = ac.ACId;
- // Ass_AssetsChangeItem.AIId = Ass_AssetsInfoItemList[i].AIId;
- // Ass_AssetsChangeItem.ACOldStock = assinfoitem.AStock;
- // Ass_AssetsChangeItem.AAmount = 1;
- // Ass_AssetsChangeItem.ACNewStock = Ass_AssetsChangeItem.ACOldStock - 1;
- // Ass_AssetsChangeItem.ACTime = DateTime.Now;
- // Ass_AssetsChangeItem.ACUserId = assinfoapp.AOCreateUserId;
- // Ass_AssetsChangeItem.ACInOrOut = false;
- // Ass_AssetsChangeItem.ACReasonType = assinfoapp.AOReasonType;
- // Ass_AssetsChangeItem.ACCStorageId = Ass_AssetsInfoItemList[i].AIIStorageId;
- // Ass_AssetsChangeItem.ACCStoragePosition = Ass_AssetsInfoItemList[i].AIIStoragePosition;
- // db.Insert(Ass_AssetsChangeItem);
- // //明细在库状态
- // Ass_AssetsInfoItemList[i].AIIsInStorage = false;
- // db.Update(Ass_AssetsInfoItemList[i]);
- // }
- // //缺货明细
- // var Ass_AssetsOutItemApplyIncomplete = new Ass_AssetsOutItemApplyIncompleteEntity();
- // Ass_AssetsOutItemApplyIncomplete.Create();
- // Ass_AssetsOutItemApplyIncomplete.AOAIId = Ass_AssetsOutApplyIncomplete.AOAIId;
- // Ass_AssetsOutItemApplyIncomplete.AOICode = outItemApply.AOICode;
- // Ass_AssetsOutItemApplyIncomplete.AOIName = outItemApply.AOIName;
- // Ass_AssetsOutItemApplyIncomplete.AOITId = outItemApply.AOITId;
- // Ass_AssetsOutItemApplyIncomplete.AOIEName = outItemApply.AOIEName;
- // Ass_AssetsOutItemApplyIncomplete.AOIPhoto = outItemApply.AOIPhoto;
- // Ass_AssetsOutItemApplyIncomplete.AOIContent = outItemApply.AOIContent;
- // Ass_AssetsOutItemApplyIncomplete.AOIOrder = outItemApply.AOIOrder;
- // Ass_AssetsOutItemApplyIncomplete.AOIModel = outItemApply.AOIModel;
- // Ass_AssetsOutItemApplyIncomplete.AOIManufacturer = outItemApply.AOIManufacturer;
- // Ass_AssetsOutItemApplyIncomplete.AOIHopeStock = outItemApply.AOIStock;
- // Ass_AssetsOutItemApplyIncomplete.AOIOutStock = Ass_AssetsInfoItemList.Count;
- // Ass_AssetsOutItemApplyIncomplete.AOIStock = outItemApply.AOIStock - Ass_AssetsInfoItemList.Count;
- // Ass_AssetsOutItemApplyIncomplete.AOIPrice = outItemApply.AOIPrice;
- // //总价计算
- // Ass_AssetsOutApplyIncomplete.AOPrice += Ass_AssetsOutItemApplyIncomplete.AOIPrice * Ass_AssetsOutItemApplyIncomplete.AOIStock;
- // Ass_AssetsOutItemApplyIncomplete.AOIUnit = outItemApply.AOIUnit;
-
- // db.Insert(Ass_AssetsOutItemApplyIncomplete);
- // }
- // else
- // {
- // if (assinfoitem.AStock > 0)
- // {
- // ifinsertac = true;
- // var Ass_AssetsInfoItem =
- // db.FindEntity(m => m.AId == assinfoitem.AId);
- // var Ass_AssetsChangeItem = new Ass_AssetsChangeItemEntity();
- // Ass_AssetsChangeItem.Create();
- // Ass_AssetsChangeItem.ACId = ac.ACId;
- // Ass_AssetsChangeItem.AIId = Ass_AssetsInfoItem.AIId;
- // Ass_AssetsChangeItem.ACOldStock = assinfoitem.AStock;
- // Ass_AssetsChangeItem.AAmount = assinfoitem.AStock;
- // Ass_AssetsChangeItem.ACNewStock = 0;
- // Ass_AssetsChangeItem.ACTime = DateTime.Now;
- // Ass_AssetsChangeItem.ACUserId = assinfoapp.AOCreateUserId;
- // Ass_AssetsChangeItem.ACInOrOut = false;
- // Ass_AssetsChangeItem.ACReasonType = assinfoapp.AOReasonType;
- // Ass_AssetsChangeItem.ACCStorageId = Ass_AssetsInfoItem.AIIStorageId;
- // Ass_AssetsChangeItem.ACCStoragePosition = Ass_AssetsInfoItem.AIIStoragePosition;
- // db.Insert(Ass_AssetsChangeItem);
- // //在库状态
- // Ass_AssetsInfoItem.AIIsInStorage = false;
- // db.Update(Ass_AssetsInfoItem);
- // }
- // //缺货明细
- // var Ass_AssetsOutItemApplyIncomplete = new Ass_AssetsOutItemApplyIncompleteEntity();
- // Ass_AssetsOutItemApplyIncomplete.Create();
- // Ass_AssetsOutItemApplyIncomplete.AOAIId = Ass_AssetsOutApplyIncomplete.AOAIId;
- // Ass_AssetsOutItemApplyIncomplete.AOICode = outItemApply.AOICode;
- // Ass_AssetsOutItemApplyIncomplete.AOIName = outItemApply.AOIName;
- // Ass_AssetsOutItemApplyIncomplete.AOITId = outItemApply.AOITId;
- // Ass_AssetsOutItemApplyIncomplete.AOIEName = outItemApply.AOIEName;
- // Ass_AssetsOutItemApplyIncomplete.AOIPhoto = outItemApply.AOIPhoto;
- // Ass_AssetsOutItemApplyIncomplete.AOIContent = outItemApply.AOIContent;
- // Ass_AssetsOutItemApplyIncomplete.AOIOrder = outItemApply.AOIOrder;
- // Ass_AssetsOutItemApplyIncomplete.AOIModel = outItemApply.AOIModel;
- // Ass_AssetsOutItemApplyIncomplete.AOIManufacturer = outItemApply.AOIManufacturer;
- // Ass_AssetsOutItemApplyIncomplete.AOIHopeStock = outItemApply.AOIStock;
- // Ass_AssetsOutItemApplyIncomplete.AOIOutStock = assinfoitem.AStock;
- // Ass_AssetsOutItemApplyIncomplete.AOIStock = outItemApply.AOIStock - assinfoitem.AStock;
- // Ass_AssetsOutItemApplyIncomplete.AOIPrice = outItemApply.AOIPrice;
- // //总价计算
- // Ass_AssetsOutApplyIncomplete.AOPrice += Ass_AssetsOutItemApplyIncomplete.AOIPrice * Ass_AssetsOutItemApplyIncomplete.AOIStock;
- // Ass_AssetsOutItemApplyIncomplete.AOIUnit = outItemApply.AOIUnit;
- // db.Insert(Ass_AssetsOutItemApplyIncomplete);
- // }
- // //库存扣减
- // assinfoitem.AStock = 0;
- //}
- //db.Update(assinfoitem);
+ db.Update(assinfoitem);
}
//出库单
if (ifinsertac)