cakephp中的传递函数请参阅我的解释

发布于 2024-09-30 04:51:52 字数 1286 浏览 5 评论 0原文

请帮助我完成我的简单的 cakephp 应用程序。

我有一个 products_warehouses 表:

--
-- Table structure for table `products_warehouses`
--

CREATE TABLE IF NOT EXISTS `products_warehouses` (
  `id` int(5) NOT NULL auto_increment,
  `product_id` int(5) NOT NULL,
  `buyprice` decimal(8,2) NOT NULL,
  `sellprice` decimal(8,2) NOT NULL,
  `date_received` date NOT NULL,
  `total_stock_received` int(3) NOT NULL,
  `stock_on_hand` int(3) NOT NULL,
  `stock_to_transfer` int(3) default NULL,
  `created` datetime NOT NULL,
  `modified` datetime NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;

我想要的是,我有一个转移功能,以便当我转移物品时。它将自动转到 products_showrooms 表,并且仓库中的 stock_to_tranfer 字段将添加到 products_showrooms 表中默认为 0 的 stock_received 中:

这是 products_showrooms 表,

--
-- Table structure for table `products_showrooms`
--

CREATE TABLE IF NOT EXISTS `products_showrooms` (
  `product_warehouse_id` int(5) NOT NULL,
  `stock_on_hand` int(2) NOT NULL,
  `stock_received` int(2) NOT NULL,
  `date_received` date NOT NULL,
  PRIMARY KEY  (`product_warehouse_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

任何人都可以帮助我吗?这些表应该有关系吗?

有人可以为我提供 Transfer() 函数的正确代码吗? 我应该在这两个表的模型和控制器中放入什么?..

谢谢..请帮助我。

please help me with my simple cakephp application.

i have a products_warehouses table:

--
-- Table structure for table `products_warehouses`
--

CREATE TABLE IF NOT EXISTS `products_warehouses` (
  `id` int(5) NOT NULL auto_increment,
  `product_id` int(5) NOT NULL,
  `buyprice` decimal(8,2) NOT NULL,
  `sellprice` decimal(8,2) NOT NULL,
  `date_received` date NOT NULL,
  `total_stock_received` int(3) NOT NULL,
  `stock_on_hand` int(3) NOT NULL,
  `stock_to_transfer` int(3) default NULL,
  `created` datetime NOT NULL,
  `modified` datetime NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;

what i want is, i have a transfer function so that when i transfer items. it would automatically go to products_showrooms table and the stock_to_tranfer field from warehouse would be added to the stock_received which is 0 in default from the products_showrooms table:

here is the products_showrooms table

--
-- Table structure for table `products_showrooms`
--

CREATE TABLE IF NOT EXISTS `products_showrooms` (
  `product_warehouse_id` int(5) NOT NULL,
  `stock_on_hand` int(2) NOT NULL,
  `stock_received` int(2) NOT NULL,
  `date_received` date NOT NULL,
  PRIMARY KEY  (`product_warehouse_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

can anyone help me with this?. should these tables have a relationship?.

can someone provide me with the right codes for a transfer() function?.
what should i put in the models and controllers of these two tables?..

thank you.. please help me.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

别在捏我脸啦 2024-10-07 04:51:52

首先,您需要将 product_warehouse_id 重命名为 products_warehouse_id。然后从食谱中学习关系类型。尝试自己编写代码,如果您无法使其正常工作,请提出问题。

First you will need to rename product_warehouse_id to products_warehouse_id. Then study relationship types from the cookbook. Try to put some effort in writing the code yourself and if you will not get it working then ask the question.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文